netem: fix skb_orphan_partial()
authorEric Dumazet <edumazet@google.com>
Thu, 11 May 2017 22:24:41 +0000 (15:24 -0700)
committerRaspbian kernel package updater <root@raspbian.org>
Sun, 23 Jul 2017 02:51:51 +0000 (02:51 +0000)
commit9353f26698320890fc7c7e81aa4d397d7373f749
treeedef852cf5abceae3ef13d12256d84d99e9aac4c
parent9988c8aeb99fd70d508d30f6a0f88e831a2d37f0
netem: fix skb_orphan_partial()

[ Upstream commit f6ba8d33cfbb46df569972e64dbb5bb7e929bfd9 ]

I should have known that lowering skb->truesize was dangerous :/

In case packets are not leaving the host via a standard Ethernet device,
but looped back to local sockets, bad things can happen, as reported
by Michael Madsen ( https://bugzilla.kernel.org/show_bug.cgi?id=195713 )

So instead of tweaking skb->truesize, lets change skb->destructor
and keep a reference on the owner socket via its sk_refcnt.

Fixes: f2f872f9272a ("netem: Introduce skb_orphan_partial() helper")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Michael Madsen <mkm@nabto.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/core/sock.c